import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';

/// 吐司提示框框
///
class ToastUtils {
  // 弹出吐司
  static showToast(String msg, {Toast? duration, ToastGravity? gravity}) {
    if (msg.isEmpty) return;

    Fluttertoast.showToast(
        msg: msg,
        toastLength: duration,
        gravity: gravity,
        backgroundColor: Colors.black38,
        textColor: Colors.white);
  }

  // 弹出吐司
  static showCenterToast(String msg, {Toast? duration, ToastGravity? gravity}) {
    if (msg.isEmpty) return;

    Fluttertoast.showToast(
        msg: msg,
        toastLength: duration,
        gravity: ToastGravity.CENTER,
        backgroundColor: Colors.black38,
        textColor: Colors.white);
  }
}
